package com.eas.biz.service.statistic.domain;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class QuestionStatistic {

    private long examId;

    private long scopeId;

    private String scopeType;

    private String subject;

    private String questionNumber;

    private boolean isObjective;

    private float totalScore;

    private float maxScore;

    private float minScore;

    private float avgScore;

    private double diviation;

    private int totalCount;

    private int correctCount;

    private int highScoreCount;

    private List<QuestionAnswerStatistic> answerStatisticList;

    private Map<String, Integer> answerMap;

    public QuestionStatistic() {
        this.answerStatisticList = new LinkedList<QuestionAnswerStatistic>();
        this.answerMap = new HashMap<String, Integer>();
    }

    public long getExamId() {
        return examId;
    }

    public void setExamId(long examId) {
        this.examId = examId;
    }

    public long getScopeId() {
        return scopeId;
    }

    public void setScopeId(long scopeId) {
        this.scopeId = scopeId;
    }

    public String getScopeType() {
        return scopeType;
    }

    public void setScopeType(String scopeType) {
        this.scopeType = scopeType;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getQuestionNumber() {
        return questionNumber;
    }

    public void setQuestionNumber(String questionNumber) {
        this.questionNumber = questionNumber;
    }

    public boolean isObjective() {
        return isObjective;
    }

    public void setObjective(boolean isObjective) {
        this.isObjective = isObjective;
    }

    public float getTotalScore() {
        return totalScore;
    }

    public void setTotalScore(float totalScore) {
        this.totalScore = totalScore;
    }

    public float getMinScore() {
        return minScore;
    }

    public void setMinScore(float minScore) {
        this.minScore = minScore;
    }

    public float getAvgScore() {
        return avgScore;
    }

    public void setAvgScore(float avgScore) {
        this.avgScore = avgScore;
    }

    public double getDiviation() {
        return diviation;
    }

    public void setDiviation(double diviation) {
        this.diviation = diviation;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getCorrectCount() {
        return correctCount;
    }

    public void setCorrectCount(int correctCount) {
        this.correctCount = correctCount;
    }

    public List<QuestionAnswerStatistic> getAnswerStatisticList() {
        return answerStatisticList;
    }

    public void setAnswerStatisticList(List<QuestionAnswerStatistic> answerStatisticList) {
        this.answerStatisticList = answerStatisticList;
    }

    public Map<String, Integer> getAnswerMap() {
        return answerMap;
    }

    public int getAnswerCount(String answer) {
        Integer count = answerMap.get(answer);
        return count != null ? count.intValue() : 0;
    }

    public void buildAnswerMap() {
        answerMap.clear();

        for (QuestionAnswerStatistic answer : answerStatisticList) {
            answerMap.put(answer.getAnswer(), answer.getCount());
        }
    }

    public int getHighScoreCount() {
        return highScoreCount;
    }

    public void setHighScoreCount(int highScoreCount) {
        this.highScoreCount = highScoreCount;
    }

    public float getMaxScore() {
        return maxScore;
    }

    public void setMaxScore(float maxScore) {
        this.maxScore = maxScore;
    }
}
